﻿using System;
using System.Windows;
using System.Windows.Controls;
using WgpgCore;

namespace WgpgGUI
{
    public partial class DialogTasks : Window
    {
        public DialogTasks(Window owner)
        {
            Owner = owner;
            InitializeComponent();
            DataContext = TaskManager.Instance.Tasks;
        }

        private void AbortTask(Object sender, RoutedEventArgs e)
        {
            Button btn = (Button)sender;
            Task task = (Task)btn.Tag;
            task.Abort();
        }

        private void ClearListButton(Object sender, RoutedEventArgs e)
        {
            TaskManager.Instance.CleanList();
        }

        private void Close(Object sender, RoutedEventArgs e)
        {
            Hide();
        }
    }
}
